import request from '@/utils/request'
const notifyConfigApi = {
  getNoticeConfigList: '/heimdallrApi/alarmNoticeConfig/page',
  addNoticeConfig: '/heimdallrApi/alarmNoticeConfig/add',
  updateNoticeConfig: '/heimdallrApi/alarmNoticeConfig/update',
  deleteNoticeConfig: '/heimdallrApi/alarmNoticeConfig/delete',
}

/**
 * 获取通知配置列表
 * @param {Object} params - 查询参数
 * @returns {Promise} - 包含通知配置列表的Promise对象
 */
export const getNoticeConfigList = (params) => {
  return request({
    url: notifyConfigApi.getNoticeConfigList,
    method: 'get',
    params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
  })
}

/**
 * 添加通知配置
 * @param {Object} data - 通知配置数据
 * @returns {Promise} - 包含添加结果的Promise对象
 */
export const addNoticeConfig = (data) => {
  return request({
    url: notifyConfigApi.addNoticeConfig,
    method: 'post',
    data,
    formData: true,
  })
}

/**
 * 更新通知配置
 * @param {Object} data - 通知配置数据
 * @returns {Promise} - 包含更新结果的Promise对象
 */
export const updateNoticeConfig = (data) => {
  return request({
    url: notifyConfigApi.updateNoticeConfig,
    method: 'post',
    data,
    formData: true,
  })
}

/**
 * 删除通知配置
 * @param {Object} params - 删除参数
 * @returns {Promise} - 包含删除结果的Promise对象
 */
export const deleteNoticeConfig = (params) => {
  return request({
    url: notifyConfigApi.deleteNoticeConfig,
    method: 'post',
    data: params,
    formData: true,
  })
}
